package org.mech.sefer.entity.bible.model;

import java.util.Collection;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import org.mech.sefer.entity.model.AbstractEntity;

/**
 * <p>
 * The Bible model
 * </p>
 * <p>
 * Date: 4.5.2012 11:22:07
 * </p>
 *
 * @author martin.krajc
 */
@Entity
@Table(name = "T_BIBLES")
public class Bible extends AbstractEntity {

	/** The Constant serialVersionUID. */
	private static final long serialVersionUID = -6977149220046446264L;

	/** The id. */
	@Id
	@SequenceGenerator(name = "T_BIBLES_SEQ", sequenceName = "T_BIBLES_SEQ", allocationSize = 1)
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "T_BIBLES_SEQ")
	@Column(name = "ID", nullable = false, updatable = false)
	private Integer id;

	/** The name of bible. */
	@Column(name = "NAME", nullable = false, length = 255)
	private String name;

	/** The books. */
	@OneToMany(mappedBy = "bible", cascade = javax.persistence.CascadeType.ALL, fetch = FetchType.LAZY)
	private Collection<Book> books;
	
	/**
	 * {@inheritDoc}
	 */
	public Integer getId() {
		return id;
	}

	/**
	 * Sets the id.
	 *
	 * @param id the new id
	 */
	public void setId(Integer id) {
		this.id = id;
	}

	/**
	 * Gets the name.
	 *
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * Sets the name of the bible
	 *
	 * @param name the new name of bible
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * Gets the books in bible
	 *
	 * @return the books in this bible
	 */
	public Collection<Book> getBooks() {
		return books;
	}

	/**
	 * Sets the books in bible
	 *
	 * @param books the new books in bible
	 */
	public void setBooks(Collection<Book> books) {
		this.books = books;
	}

}
